/**
 * Copyright (c) Enalean, 2018. All Rights Reserved.
 *
 * This file is a part of Tuleap.
 *
 * Tuleap is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Tuleap is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tuleap. If not, see <http://www.gnu.org/licenses/>.
 */
@import '../../../../../src/www/themes/common/css/utils/colors';
@import '../../../../../src/www/themes/FlamingParrot/css/utils/badge-colors';

@mixin message-colors($color) {
    border: 1px solid $color;
    color: $color;

    a {
        color: $color;
        text-decoration: underline;
    }
}

@mixin change-button-color($color) {
    border-color: $color;
    background: $color;
    transition: box-shadow 75ms ease-in-out, background 75ms ease-in-out, border-color 75ms ease-in-out;

    &:hover {
        transition: box-shadow 75ms ease-in-out, background 75ms ease-in-out, border-color 75ms ease-in-out;
        border-color: darken($color, 5%);
        background: darken($color, 5%);
        box-shadow: none;
    }

    &:active,
    &:focus {
        transition: box-shadow 75ms ease-in-out, background 75ms ease-in-out, border-color 75ms ease-in-out;
        border-color: darken($color, 10%);
        background: darken($color, 10%);
        box-shadow: none;
    }
}

@mixin definitions($main, $color-name, $ui-color-danger, $ui-color-success) {
    .call-me-back {
        position: fixed;
        z-index: 10000;
        right: 40px;
        bottom: 40px;
        font-family: 'SourceSansPro', 'Helvetica Neue', Arial, sans-serif;

        + .bootstrap-datetimepicker-widget {
            z-index: 10001;
            transform: translate(-30px, -32px);

            &:before,
            &:after {
                display: none;
            }
        }
    }

    .call-me-back-message {
        position: absolute;
        top: 5px;
        left: 50%;
        box-sizing: border-box;
        width: 150px;
        padding: 20px;
        transform: translateX(-50%) translateY(-100%);
        border-radius: 3px;
        background: transparentize(#ffffff, .2);
        font-size: 14px;
        font-weight: 600;
        line-height: 22px;
        text-align: center;
        cursor: default;

        @if $color-name == 'blue' {
            @include message-colors(#f57c13);
        } @else if $color-name == 'green' {
            @include message-colors(#bd2626);
        } @else if $color-name == 'bluegrey' {
            @include message-colors(#f57c13);
        } @else if $color-name == 'orange' {
            @include message-colors(#1593c4);
        } @else if $color-name == 'purple' {
            @include message-colors(#f57c13);
        } @else if $color-name == 'red' {
            @include message-colors(#67af45);
        }

        > p {
            font-size: 14px;
            line-height: 22px;

            &:last-child {
                margin-bottom: 0;
            }
        }
    }

    .call-me-back-button {
        position: relative;
        z-index: 10001;
        width: 85px;
        height: 85px;
        overflow: visible;
        border: 0;
        border-radius: 50%;
        box-shadow: 0 3px 9px 0 rgba(0, 0, 0, .29);
        color: #ffffff;
        font-size: 30px;

        @if $color-name == 'blue' {
            @include change-button-color(#f57c13);
        } @else if $color-name == 'green' {
            @include change-button-color(#bd2626);
        } @else if $color-name == 'bluegrey' {
            @include change-button-color(#f57c13);
        } @else if $color-name == 'orange' {
            @include change-button-color(#1593c4);
        } @else if $color-name == 'purple' {
            @include change-button-color(#f57c13);
        } @else if $color-name == 'red' {
            @include change-button-color(#67af45);
        }
    }

    .call-me-back-form {
        box-sizing: border-box;
        width: 220px;
        padding: 20px;

        > form {
            margin: 0;

            > .call-me-back-form-intro {
                margin: 0 0 20px;
            }

            > .alert-error {
                padding: 10px;
                font-size: 14px;
            }

            > label {
                color: #666666;
                font-weight: 600;

                > .fa-asterisk {
                    position: relative;
                    top: -4px;
                    color: $ui-color-danger;
                    font-size: 11px;
                }
            }

            > .input-prepend {
                width: calc(100% - 40px);
                margin: 0 0 20px;
            }

            .fa-calendar {
                cursor: pointer;
            }

            input[type='text'],
            button {
                width: 100%;
            }
        }
    }

    .call-me-back-save-the-date {
        display: flex;
        flex-direction: column;
        align-items: center;

        > .fa-thumbs-o-up {
            margin: 0 0 20px;
            color: $ui-color-success;
            font-size: 65px;
        }

        > .call-me-back-save-the-date-text {
            margin: 0 0 20px;
            font-size: 16px;
            text-align: center;
        }

        > .badge-success {
            padding: 10px 14px;
            border: 1px solid $ui-color-success;
            border-radius: 20px;
            background: transparent;
            color: $ui-color-success;
            font-size: 16px;
            text-shadow: none;
        }
    }

}

body {
    &.FlamingParrot_Orange {
        @import 'variables-orange';

        @include definitions($main, $color-name, $ui-color-danger, $ui-color-success);
    }

    &.FlamingParrot_Blue {
        @import 'variables-blue';

        @include definitions($main, $color-name, $ui-color-danger, $ui-color-success);
    }

    &.FlamingParrot_Green {
        @import 'variables-green';

        @include definitions($main, $color-name, $ui-color-danger, $ui-color-success);
    }

    &.FlamingParrot_BlueGrey {
        @import 'variables-bluegrey';

        @include definitions($main, $color-name, $ui-color-danger, $ui-color-success);
    }

    &.FlamingParrot_Purple {
        @import 'variables-purple';

        @include definitions($main, $color-name, $ui-color-danger, $ui-color-success);
    }

    &.FlamingParrot_Red {
        @import 'variables-red';

        @include definitions($main, $color-name, $ui-color-danger, $ui-color-success);
    }
}
